#!/usr/bin/perl
#setupwiz.cgi

require './web-lib.pl';

&init_config();
&ReadParse();

($curstep, $stepsref) = &get_wizard_conf();
if ($in{'step'} eq "")
{
 $in{'step'} = $curstep;
}
if (($in{'step'} eq "") or ($in{'step'} < 0))
{
 $in{'step'} = 0;
}
elsif ($in{'step'} > @$stepsref )
{
 $in{'step'} = @$stepsref + 1;
}

if ($in{'step'} ==0)
{
        $steppage = "startwizard.cgi";
}
elsif ($in{'step'} == (@$stepsref+1))
{
        $steppage = "finishwizard.cgi";
}
else
{
        $steppage = $stepsref->[$in{'step'}-1];
}

local $charset = defined($force_charset) ? $force_charset :
                 $current_lang_info->{'charset'} ?
                 $current_lang_info->{'charset'} : "iso-8859-1";
&PrintHeader($charset);
print "<!doctype html public \"-//W3C//DTD HTML 3.2 Final//EN\">\n";
print "<html>\n";

if ($charset) {
    print "<meta http-equiv=\"Content-Type\" ",
          "content=\"text/html; Charset=$charset\">\n";
    }
print "<head>\n";
print "<title>$text{'setup_wizard_title'}</title>\n";
print "</head>\n";
print "<frameset rows=\"*,55\">\n";
print "<frame name=\"main\" src=\"$steppage\" scrolling=\"auto\">\n";
print " <frame name=\"navigate\" scrolling=\"no\" noresize target=\"main\" src=\"navigate.cgi?step=$in{'step'}\">\n";
print qq~ <noframes>
  <body>

  <p>The page uses frame,but your browser do not support frame.</p>

  </body>
  </noframes>
</frameset>

</html>~;
&set_wizard_conf($in{'step'});

